//
// Created by weiyixing on 24-11-13.
//
/**
 * 3.1
 * 写一个文本文件读取程序，将文件中每一个word 存入map，key是woard，value is word occur counts
 * and 在定义一个违禁词set，在新词插入map前，先检查set中是否有，一旦文本读取完毕，列出单词和出现次数的清单
**/


#ifndef GTEST14_TEXTHELPER_H
#define GTEST14_TEXTHELPER_H
#include <map>
#include <string>
#include <set>
#include <utility>
#include <vector>
class TextHelper {

  explicit TextHelper(std::string  filePath):_filePath(std::move(filePath)){}
  void readText();
  bool isExist(const std::string & word);
  void getWordCont();
  void displayResult();
  void run();

private:
  std::string _filePath;
  std::vector<std::string> _text;
  std::map<std::string,std::int64_t> _wordCounter;
  const std::set<std::string> _prohibitedWords={"and","or","how","but","I"};

};

#endif // GTEST14_TEXTHELPER_H
